package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import com.buanalintas.bynga.entities.MasterUser;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "pos_transaction_distribution")
@XmlRootElement
//@NamedQueries({
//    @NamedQuery(name = "PosTransactionDistribution.findAll", query = "SELECT t FROM PosTransactionDistribution t"),
//    @NamedQuery(name = "PosTransactionDistribution.findBySync", query = "SELECT t FROM PosTransactionDistribution t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionId", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionId = :distributionId"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionUserId", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionUserId = :distributionUserId"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionUnitId", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionUnitId = :distributionUnitId"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionDestinationUnitId", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionDestinationUnitId = :distributionDestinationUnitId"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionNumber", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionNumber = :distributionNumber"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionDate", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionDate = :distributionDate"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionStatus", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionStatus = :distributionStatus"),
//    @NamedQuery(name = "PosTransactionDistribution.findByDistributionTimestamt", query = "SELECT t FROM PosTransactionDistribution t WHERE t.distributionTimestamp = :distributionTimestamt")})
public class PosTransactionDistribution implements Serializable {

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "distribution_id")
    private Integer distributionId;
    @Basic(optional = false)
    @Column(name = "distribution_number")
    private String distributionNumber;
    @Basic(optional = false)
    @Column(name = "distribution_date")
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date distributionDate;
    @Basic(optional = false)
    @Column(name = "distribution_total")
    private BigDecimal distributionTotal;
    @Basic(optional = false)
    @Column(name = "distribution_paid")
    private BigDecimal distributionPaid;
    @Basic(optional = false)
    @Column(name = "distribution_keel")
    private String distributionKeel;
    @Basic(optional = false)
    @Column(name = "distribution_progress")
    private String distributionProgress;
    @Basic(optional = false)
    @Column(name = "distribution_reject_reason")
    private String distributionRejectReason;
    @Basic(optional = false)
    @Lob
    @Column(name = "distribution_description")
    private String distributionDescription;
    @Basic(optional = false)
    @Column(name = "distribution_timestamp")
    @Temporal(TemporalType.DATE)
    private Date distributionTimestamp;
    @JoinColumn(name = "distribution_user_id", referencedColumnName = "user_id")
    @ManyToOne(optional = false)
    private MasterUser distributionUserId;
    @JoinColumn(name = "distribution_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit distributionUnitId;
    @JoinColumn(name = "distribution_destination_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit distributionDestinationUnitId;
    @JoinColumn(name = "distribution_status_id", referencedColumnName = "status_id")
    @ManyToOne(optional = false)
    private PosMasterStatus distributionStatusId;

    public PosTransactionDistribution() {
    }

    public PosTransactionDistribution(Integer distributionId) {
        this.distributionId = distributionId;
    }

    public PosTransactionDistribution(Integer distributionId, String distributionNumber, Date distributionDate, String distributionStatus, String distributionDescription, Date distributionTimestamp) {
        this.distributionId = distributionId;
        this.distributionNumber = distributionNumber;
        this.distributionDate = distributionDate;
        this.distributionDescription = distributionDescription;
        this.distributionTimestamp = distributionTimestamp;
    }

    public Date getDistributionDate() {
        return distributionDate;
    }

    public void setDistributionDate(Date distributionDate) {
        this.distributionDate = distributionDate;
    }

    public String getDistributionProgress() {
        return distributionProgress;
    }

    public void setDistributionProgress(String distributionProgress) {
        this.distributionProgress = distributionProgress;
    }

    public String getDistributionRejectReason() {
        return distributionRejectReason;
    }

    public void setDistributionRejectReason(String distributionRejectReason) {
        this.distributionRejectReason = distributionRejectReason;
    }

    public String getDistributionDescription() {
        return distributionDescription;
    }

    public void setDistributionDescription(String distributionDescription) {
        this.distributionDescription = distributionDescription;
    }

    public MasterUnit getDistributionDestinationUnitId() {
        return distributionDestinationUnitId;
    }

    public void setDistributionDestinationUnitId(MasterUnit distributionDestinationUnitId) {
        this.distributionDestinationUnitId = distributionDestinationUnitId;
    }

    public Integer getDistributionId() {
        return distributionId;
    }

    public void setDistributionId(Integer distributionId) {
        this.distributionId = distributionId;
    }

    public String getDistributionNumber() {
        return distributionNumber;
    }

    public BigDecimal getDistributionTotal() {
        return distributionTotal;
    }

    public void setDistributionTotal(BigDecimal distributionTotal) {
        this.distributionTotal = distributionTotal;
    }

    public BigDecimal getDistributionPaid() {
        return distributionPaid;
    }

    public void setDistributionPaid(BigDecimal distributionPaid) {
        this.distributionPaid = distributionPaid;
    }

    public String getDistributionKeel() {
        return distributionKeel;
    }

    public void setDistributionKeel(String distributionKeel) {
        this.distributionKeel = distributionKeel;
    }

    public void setDistributionNumber(String distributionNumber) {
        this.distributionNumber = distributionNumber;
    }

    public PosMasterStatus getDistributionStatusId() {
        return distributionStatusId;
    }

    public void setDistributionStatusId(PosMasterStatus distributionStatusId) {
        this.distributionStatusId = distributionStatusId;
    }

    public Date getDistributionTimestamp() {
        return distributionTimestamp;
    }

    public void setDistributionTimestamp(Date distributionTimestamp) {
        this.distributionTimestamp = distributionTimestamp;
    }

    public MasterUnit getDistributionUnitId() {
        return distributionUnitId;
    }

    public void setDistributionUnitId(MasterUnit distributionUnitId) {
        this.distributionUnitId = distributionUnitId;
    }

    public MasterUser getDistributionUserId() {
        return distributionUserId;
    }

    public void setDistributionUserId(MasterUser distributionUserId) {
        this.distributionUserId = distributionUserId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (distributionId != null ? distributionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosTransactionDistribution)) {
            return false;
        }
        PosTransactionDistribution other = (PosTransactionDistribution) object;
        if ((this.distributionId == null && other.distributionId != null) || (this.distributionId != null && !this.distributionId.equals(other.distributionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return distributionNumber;
//        return "com.buanalintas.sandals.pos.entities.PosTransactionDistribution[ distributionId=" + distributionId + " ]";
    }
}
